package com.isdepci.project.reference.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.isdepci.framework.aspectj.lang.annotation.Log;
import com.isdepci.framework.aspectj.lang.enums.BusinessType;
import com.isdepci.project.reference.domain.WasteEfs;
import com.isdepci.project.reference.service.IWasteEfsService;
import com.isdepci.framework.web.controller.BaseController;
import com.isdepci.framework.web.domain.AjaxResult;
import com.isdepci.common.utils.poi.ExcelUtil;
import com.isdepci.framework.web.page.TableDataInfo;

/**
 * 废弃EFsController
 *
 * @author isdepci
 * @date 2023-08-22
 */
@RestController
@RequestMapping("/reference/referenceWasteEfs")
public class WasteEfsController extends BaseController
{
    @Autowired
    private IWasteEfsService wasteEfsService;

    /**
     * 查询废弃EFs列表
     */
    @PreAuthorize("@ss.hasPermi('reference:referenceWasteEfs:list')")
    @GetMapping("/list")
    public TableDataInfo list(WasteEfs wasteEfs)
    {
        startPage();
        List<WasteEfs> list = wasteEfsService.selectWasteEfsList(wasteEfs);
        return getDataTable(list);
    }

    /**
     * 导出废弃EFs列表
     */
    @PreAuthorize("@ss.hasPermi('reference:referenceWasteEfs:export')")
    @Log(title = "废弃EFs", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WasteEfs wasteEfs)
    {
        List<WasteEfs> list = wasteEfsService.selectWasteEfsList(wasteEfs);
        ExcelUtil<WasteEfs> util = new ExcelUtil<WasteEfs>(WasteEfs.class);
        return util.exportExcel(list, "referenceWasteEfs");
    }

    /**
     * 获取废弃EFs详细信息
     */
    @PreAuthorize("@ss.hasPermi('reference:referenceWasteEfs:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(wasteEfsService.selectWasteEfsById(id));
    }

    /**
     * 新增废弃EFs
     */
    @PreAuthorize("@ss.hasPermi('reference:referenceWasteEfs:add')")
    @Log(title = "废弃EFs", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WasteEfs wasteEfs)
    {
        return toAjax(wasteEfsService.insertWasteEfs(wasteEfs));
    }

    /**
     * 修改废弃EFs
     */
    @PreAuthorize("@ss.hasPermi('reference:referenceWasteEfs:edit')")
    @Log(title = "废弃EFs", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WasteEfs wasteEfs)
    {
        return toAjax(wasteEfsService.updateWasteEfs(wasteEfs));
    }

    /**
     * 删除废弃EFs
     */
    @PreAuthorize("@ss.hasPermi('reference:referenceWasteEfs:remove')")
    @Log(title = "废弃EFs", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wasteEfsService.deleteWasteEfsByIds(ids));
    }
}
